﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CarsModel;
using System.Data;
using System.Data.SqlClient;
using Lib.Data;
namespace CarsDal
{
    public class CarsModelsDal
    {
        public static string ConnectionString = "Data Source=47.93.36.227;Initial Catalog=SecondHandCars;User ID=Yang;Pwd=qaz@WSXedc";
        SqlConnection con = new SqlConnection(ConnectionString);
        /// <summary>
        /// 汽车类型的显示SUV?MPV?轿车？跑车？
        /// </summary>
        /// <returns></returns>
        public List<CarsModels> CarsModelsShow()
        {
            string sql = "select * from CarsModels";
            SqlCommand com = new SqlCommand(sql, con);
            SqlDataAdapter ter = new SqlDataAdapter(com);
            DataTable dt = new DataTable();
            ter.Fill(dt);
            ter.Dispose();
            List<CarsModels> list = DataTableToList.DataTableToLista<CarsModels>(dt);
            return list;
        }
    }
}
